﻿@using GoodMan.Infrastructure.Entities.Entity;
@{
    Layout = "~/Views/Shared/_Main.cshtml";
    int productId = ViewBag.productiId == null ? 0 : ViewBag.productiId;
    Product product = ViewBag.product == null ? new Product() : ViewBag.product;
    ItemListBox<OrderDetail> orderDetails = ViewBag.saleRecord;
}
<div class="container">
    <ul class="breadcrumb">
        <li><a href="../home/index">首页</a> <span class="divider">></span></li>
        <li class="active">销售记录</li>
    </ul>
    <div class="row">
        <div class="span12">
            <div class="row-fluid">
                <input type="hidden" id="productid" name="id" value="@productId" />
                <div class="group-on-title">
                    <h4>@product.ProductName</h4>
                </div>
            </div>
            <div class="tabbable">
                <div style="overflow: hidden">
                <div class="tab-pane" id="tab2" style="overflow: hidden">
                        <h4 class="border-bottom-gray red bg-bar">
                            &nbsp;&nbsp;销售记录</h4>
                    <table class="table" width="100%">
                        <thead>
                            <tr>
                                <th>
                                    买家
                                </th>
                                @{
                                    if(product.AreaCode==GoodMan.Infrastructure.Entities.Enum.AreaCode.Integration)
                                    {
                                        <th>
                                    积分
                                </th>
                                    }
                                    else
                                    {
                                        <th>
                                    价格
                                </th>
                                    }
                                }
                                
                                <th>
                                    数量
                                </th>
                                <th>
                                    购买时间
                                </th>
                            </tr>
                        </thead>
                        <tbody>
                            @{
                                if (orderDetails != null && orderDetails.Data != null && orderDetails.Data.Any())
                                {
                                    foreach (var item in orderDetails.Data)
                                    {
                                        string orderdate = item.order.OrderDate.ToString("yyyy-MM-dd HH:mm:ss");
                                <tr>
                                    <td>
                                        @item.user.NickName
                                    </td>
                                    @{
                                    if(product.AreaCode==GoodMan.Infrastructure.Entities.Enum.AreaCode.Integration)
                                    {
                                         double price = Convert.ToDouble(item.Price);
                                                        <td>
                                                        @price
                                                        </td>
                                    }
                                    else
                                    {
                                      <td>
                                        @item.Price
                                    </td>
                                    }
                                }
                                    
                                    <td>
                                        @item.Num
                                    </td>
                                    <td>
                                        @orderdate
                                    </td>
                                </tr>
                                    }
                                }
                            }
                        </tbody>
                    </table>
                </div>
                <!--分页-->
                <div class="pagination text-center">
                    @Html.Raw(orderDetails.PageItemSegment)
                </div>
                <!--#分页-->
            </div>
        </div>
    </div>
</div>
